//
//  TotalView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/19.
//

#import "TotalView.h"

@implementation TotalView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUI];
    }
    return self;
}
-(void)CreateUI{
    
    UIView *backview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, APPwidth, 120)];
    backview.backgroundColor = [UIColor whiteColor];
    [self addSubview:backview];

       //统计
       UIView *totalLine = [[UIView alloc]initWithFrame:CGRectMake(15, 10, 3, 15)];
       totalLine.backgroundColor = rgba(22, 120, 255, 1);
       totalLine.layer.cornerRadius = 2;
       [backview addSubview:totalLine];
       UILabel *totalLab = [[UILabel alloc]initWithFrame:CGRectMake(totalLine.frame.size.width+totalLine.frame.origin.x+5, 10, 70, 15)];
       totalLab.text = @"统计";
       totalLab.textColor = [UIColor blackColor];
       totalLab.textAlignment = 0;
       totalLab.font = [UIFont systemFontOfSize:16 weight:bold];
       [backview addSubview:totalLab];
   
       NSArray *totalArr = @[@"total"];
       NSArray *totalLabArr = @[@"授课统计"];
       for (int i = 0; i < totalArr.count; i++) {
           UIButton *totalBtn = [[UIButton alloc]initWithFrame:CGRectMake(i*APPwidth/4,totalLab.height+totalLab.y +10, APPwidth/4, 60)];
           totalBtn.titleLabel.font = [UIFont systemFontOfSize:14];
           totalBtn.titleLabel.textAlignment = 1;
           [totalBtn setTitleColor:rgba(51, 51, 51, 1) forState:0];
           [totalBtn setImage:[UIImage imageNamed:totalArr[i]] forState:0];
           [totalBtn setTitle:totalLabArr[i] forState:0];
           totalBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 25, 15, 25);
           [totalBtn.imageView setContentMode:UIViewContentModeScaleAspectFit];
           totalBtn.titleEdgeInsets = UIEdgeInsetsMake(60, -45, 0, 0);
           [backview addSubview:totalBtn];
   
           if (i == 0) {
//               _totalBtn = totalBtn;
           }
       }
}

@end
